3.2.38 \(\int (a+b \tanh ^2(c+d x)) \, dx\) [138]

Optimal. Leaf size=19 \[ a x+b x-\frac {b \tanh (c+d x)}{d} \]

[Out]

a*x+b*x-b*tanh(d*x+c)/d

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 19, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {3554, 8} \begin {gather*} a x-\frac {b \tanh (c+d x)}{d}+b x \end {gather*}

Antiderivative was successfully verified.

[In]

Int[a + b*Tanh[c + d*x]^2,x]

[Out]

a*x + b*x - (b*Tanh[c + d*x])/d

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps

\begin {align*} \int \left (a+b \tanh ^2(c+d x)\right ) \, dx &=a x+b \int \tanh ^2(c+d x) \, dx\\ &=a x-\frac {b \tanh (c+d x)}{d}+b \int 1 \, dx\\ &=a x+b x-\frac {b \tanh (c+d x)}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 28, normalized size = 1.47 \begin {gather*} a x+\frac {b \tanh ^{-1}(\tanh (c+d x))}{d}-\frac {b \tanh (c+d x)}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[a + b*Tanh[c + d*x]^2,x]

[Out]

a*x + (b*ArcTanh[Tanh[c + d*x]])/d - (b*Tanh[c + d*x])/d

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(46\) vs. \(2(19)=38\).
time = 0.28, size = 47, normalized size = 2.47

method result size
risch \(a x +b x +\frac {2 b}{d \left (1+{\mathrm e}^{2 d x +2 c}\right )}\) \(27\)
default \(a x -\frac {b \tanh \left (d x +c \right )}{d}-\frac {b \ln \left (\tanh \left (d x +c \right )-1\right )}{2 d}+\frac {b \ln \left (1+\tanh \left (d x +c \right )\right )}{2 d}\) \(47\)
derivativedivides \(\frac {-b \tanh \left (d x +c \right )+\frac {\left (-a -b \right ) \ln \left (\tanh \left (d x +c \right )-1\right )}{2}-\frac {\left (-a -b \right ) \ln \left (1+\tanh \left (d x +c \right )\right )}{2}}{d}\) \(51\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(a+b*tanh(d*x+c)^2,x,method=_RETURNVERBOSE)

[Out]

a*x-b*tanh(d*x+c)/d-1/2*b/d*ln(tanh(d*x+c)-1)+1/2*b/d*ln(1+tanh(d*x+c))

________________________________________________________________________________________

Maxima [A]
time = 0.29, size = 31, normalized size = 1.63 \begin {gather*} b {\left (x + \frac {c}{d} - \frac {2}{d {\left (e^{\left (-2 \, d x - 2 \, c\right )} + 1\right )}}\right )} + a x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a+b*tanh(d*x+c)^2,x, algorithm="maxima")

[Out]

b*(x + c/d - 2/(d*(e^(-2*d*x - 2*c) + 1))) + a*x

________________________________________________________________________________________

Fricas [A]
time = 0.35, size = 37, normalized size = 1.95 \begin {gather*} \frac {{\left ({\left (a + b\right )} d x + b\right )} \cosh \left (d x + c\right ) - b \sinh \left (d x + c\right )}{d \cosh \left (d x + c\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a+b*tanh(d*x+c)^2,x, algorithm="fricas")

[Out]

(((a + b)*d*x + b)*cosh(d*x + c) - b*sinh(d*x + c))/(d*cosh(d*x + c))

________________________________________________________________________________________

Sympy [A]
time = 0.06, size = 20, normalized size = 1.05 \begin {gather*} a x + b \left (\begin {cases} x - \frac {\tanh {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \tanh ^{2}{\left (c \right )} & \text {otherwise} \end {cases}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a+b*tanh(d*x+c)**2,x)

[Out]

a*x + b*Piecewise((x - tanh(c + d*x)/d, Ne(d, 0)), (x*tanh(c)**2, True))

________________________________________________________________________________________

Giac [A]
time = 0.42, size = 29, normalized size = 1.53 \begin {gather*} a x + \frac {{\left (d x + c + \frac {2}{e^{\left (2 \, d x + 2 \, c\right )} + 1}\right )} b}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a+b*tanh(d*x+c)^2,x, algorithm="giac")

[Out]

a*x + (d*x + c + 2/(e^(2*d*x + 2*c) + 1))*b/d

________________________________________________________________________________________

Mupad [B]
time = 0.07, size = 18, normalized size = 0.95 \begin {gather*} x\,\left (a+b\right )-\frac {b\,\mathrm {tanh}\left (c+d\,x\right )}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(a + b*tanh(c + d*x)^2,x)

[Out]

x*(a + b) - (b*tanh(c + d*x))/d

________________________________________________________________________________________